package com.company.project;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.context.request.async.DeferredResult;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;


/**
 *
 */
@Configuration
@EnableSwagger2
public class Swagger2Config {

    @Bean
    public Docket createBaseRestApi2() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(productApiInfo())
                .groupName("业务模块")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.company.project.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo productApiInfo() {
        ApiInfo apiInfo = new ApiInfoBuilder()
                .title("民生矛盾化解协同处理平台")
                .description("文档描述。。。")
                .version("1.0")
                .termsOfServiceUrl("API TERMS URL")
                .license("license")
                .licenseUrl("license url")
                .contact("953799106@qq.com")
                .build();

        return apiInfo;
    }

}